using System;
using UnityEngine;

namespace Framework.UI
{
    public class UIPanel : MonoBehaviour
    {
        [Header("UI Panel")]
        [SerializeField, ReadOnly] private UIPanelGroup panelGroup;
        [SerializeField] private string name;
        public string Name => name;

        protected virtual void RegisterUIGroup()
        {
            if (panelGroup == null) panelGroup = GetComponentInParent<UIPanelGroup>();
            if (panelGroup == null) throw new Exception("Unable to find UI Component.");
        }
        
        private void Reset()
        {
            throw new NotImplementedException();
        }

        protected virtual void Awake()
        {
            if (panelGroup == null) GetComponentInParent<UIPanelGroup>();
            if (panelGroup == null) throw new Exception("Unable to find UIWindow Component.");
        }
    }
}